package org.ielts.service;

import org.ielts.domain.course.Subject;
import org.ielts.domain.query.SubjectQuery;
import org.ielts.repository.course.SubjectRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SubjectService {

	@Autowired
	SubjectRepository subjectRepository;

	public Page<Subject> listSubject(Pageable pageable) {
		Page<Subject> subjects = subjectRepository.findAll(pageable);

		return subjects;
	}

	public Page<Subject> listSubject(SubjectQuery subjectQuery, Pageable pageable) {
		Page<Subject> subjects = subjectRepository.findAll(subjectQuery, pageable);

		return subjects;
	}

	public Subject find(String id) {
		Subject subject = subjectRepository.findOne(id);

		return subject;
	}
}
